*********************************************************************
*********************************************************************
*********			REPLICATION FILE 				*****************
*********   Sanctions and Target Public Opinion  	*****************
********* 				Omer Zarpli					*****************
*********				1/23/2023					*****************
*********************************************************************
*********************************************************************

clear
use "/Users/ozarpli/Desktop/Journal Submissions/II/II_Replication/Survey Data.dta"
set scheme plottig
*download `egenmore' package

*Coding treatments
gen control=. 
replace control=1 if FL_5_DO=="Control"
replace control=0 if control==.
gen treat_cert=. 
replace treat_cert=1 if FL_5_DO=="Treatment1"
replace treat_cert=0 if treat_cert==. 
gen treat_cert_cost=.
replace treat_cert_cost=1 if FL_5_DO=="Treatment2"
replace treat_cert_cost=0 if treat_cert_cost==.
gen treat_uncert=. 
replace treat_uncert=1 if FL_5_DO=="Treatment3"
replace treat_uncert=0 if treat_uncert==.
gen treat_uncert_cost=. 
replace treat_uncert_cost=1 if FL_5_DO=="Treatment4"
replace treat_uncert_cost=0 if treat_uncert_cost==.

gen uncertain_combined=. 
replace uncertain_combined=1 if FL_5_DO=="Treatment3" | FL_5_DO=="Treatment4"
replace uncertain_combined=0 if uncertain_combined==. 
gen certain_combined=.
replace certain_combined=1 if FL_5_DO=="Treatment1" | FL_5_DO=="Treatment2"
replace certain_combined=0 if certain_combined==. 

gen treat_categorical=. 
replace treat_categorical=1 if FL_5_DO=="Treatment1"
replace treat_categorical=2 if FL_5_DO=="Treatment2"
replace treat_categorical=3 if FL_5_DO=="Treatment3"
replace treat_categorical=4 if FL_5_DO=="Treatment4"
replace treat_categorical=0 if FL_5_DO=="Control"


***Figure 1
oprobit policy_change treat_cert treat_cert_cost treat_uncert treat_uncert_cost age female edu_college4 US1 Russia1 progov 
coefplot, drop(_cons) level(95 90)

***Table 2
*Model 1
oprobit policy_change uncertain_combined progov age female edu_college4 US1 Russia1 if FL_5_DO!="Control"
*Model 2
oprobit policy_change i.uncertain_combined##i.progov age female edu_college4 US1 Russia1 if FL_5_DO!="Control"


*Figure 3
egen Mean = mean(policy_change) if progov==1, by(treat_categorical)
egen error = semean(policy_change) if progov==1, by(treat_categorical)
serrbar Mean error treat_categorical if FL_5_DO!="Control", scale (1.645) 


***Appendix*** 
*Table A1
tabstat policy_change age female edu_college4 progov US1 Russia1 US2 Russia2, stats(mean sd n)

*Table A2
oneway female treat_categorical, tabulate
oneway age treat_categorical, tabulate
oneway edu_college4 treat_categorical, tabulate 
oneway progov treat_categorical, tabulate 
oneway US1 treat_categorical, tabulate 

*Table A3
oprobit policy_change treat_uncert_cost age female edu_college4 US1 Russia1 progov if FL_5_DO=="Treatment3" | FL_5_DO=="Treatment4" 

*Figure A2 
kdensity age if female == 0, addplot(kdensity age if female == 1) legend(pos(1) ring(0))
